from flask import Blueprint, render_template,session
from flask_login import login_required, current_user
from applications.models import User,SysConfig
bp = Blueprint('index', __name__, url_prefix='/')


# 首页
@bp.get('/')
@login_required
def index():
    user = current_user
    sysconfig = SysConfig.query.all()
    powers=session['permissions']
    # 把系统配置放进去
    for con in sysconfig:
        if con.code in powers:
            if con.enable == 0:
                powers.remove(con.code)
        else:
            if not con.enable==0:
                powers.append(con.code)
    return render_template('system/index.html', user=user)


